package com.ljz.common.utils;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class DateUtil {

    /**
     * 获取系统时间并格式化
     * @return
     */
    public static String getYMD() {
        LocalDate localDate = LocalDate.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return localDate.format(formatter);
    }

    /**
     * 生成年月
     * @return
     */
    public static String getYm(){
        LocalDate localDate = LocalDate.now();//获取系统时间
        //获取指定格式的实例
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
        return localDate.format(formatter);
    }
}
